/*package com.pactera.integral.CROS;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class CORSFilter implements Filter {

    @Override
    public void destroy() {
        System.out.println("Filter-destroy");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
            throws IOException, ServletException {
        //String origin = (String) servletRequest.getRemoteHost()+":"+servletRequest.getRemotePort();
    	HttpServletRequest req = (HttpServletRequest) servletRequest;
		HttpServletResponse resp = (HttpServletResponse) servletResponse;

		// TODO
		// 允许跨域，存在安全问题，后续需要换成前端工程的域名(换成前端项目的域名)
		resp.setHeader("Access-Control-Allow-Origin", "*");
		//判断是前端工程的域名
		resp.setHeader("Access-Control-Allow-Credentials", "true");

		// 响应类型
		//resp.setHeader("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS");
		resp.setHeader("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS");
		resp.setHeader("Access-Control-Expose-Headers", "X_Auth_Token,Content-Range,X-Content-Range");
		
		// 响应头设置
		resp.setHeader("Access-Control-Allow-Headers", "Origin,Accept,Filter,Content-Range,X-Content-Range,Range,X-Range,x-requested-with,content-type,Access-Token,Authentication,Authorization");
		if("OPTIONS".equals(req.getMethod())){
			resp.setContentType("");
			return ;
		}
		filterChain.doFilter(servletRequest, servletResponse);
    }

    @Override
    public void init(FilterConfig arg0) throws ServletException {
        System.out.println("Filter-init");
    }
}*/